package com.dataart.productshop.service.impl;

import com.dataart.productshop.dao.StudentDao;
import com.dataart.productshop.model.boiko.informationsystem.Lecturer;
import com.dataart.productshop.model.boiko.informationsystem.Student;
import com.dataart.productshop.service.StudentManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

@Service
@Transactional
public class StudentManagerImpl extends BaseManagerImpl<Student> implements StudentManager{

    @Autowired
    public void setStudentDao(StudentDao studentDao){
        this.studentDao = studentDao;
        setBaseDao(studentDao);
    }

    @Override
    public List<Student> getByName(String name){
        List<Student> sts = studentDao.getByName(name);
        return sts == null ? new ArrayList<Student>(0) : sts;
    }

    @Override
    public List<Student> getStudentByNameQuery(String query){
        List<Student> sts = studentDao.getStudentByNameQuery(query);
        return sts == null ? new ArrayList<Student>(0) : sts;
    }
}
